﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace OpiConsole
{
    public class RectangleSprite
    {
        /// <summary>
        /// Position of the image
        /// </summary>
        public Vector2 Position
        {
            get { return m_vPos; }
            set { m_vPos = value; }
        }
        private Vector2 m_vPos;

        /// <summary>
        /// Size of the image
        /// </summary>
        public Vector2 Size
        {
            get { return m_vSize; }
            set { m_vSize = value; }
        }
        private Vector2 m_vSize;

        /// <summary>
        /// Colour to shade the image
        /// </summary>
        public Color Colour
        {
            get { return m_cColour; }
            set { m_cColour = value; }
        }
        private Color m_cColour;

        private Texture2D m_pImage;

        public RectangleSprite(int x, int y, int w, int h, Texture2D texture)
        {
            m_vPos.X = x;
            m_vPos.Y = y;

            m_vSize.X = w;
            m_vSize.Y = h;

            m_pImage = texture;
            m_cColour = Microsoft.Xna.Framework.Graphics.Color.Black;
        }

        public RectangleSprite(Rectangle rect, Texture2D texture)
        {
            m_vPos.X = rect.X;
            m_vPos.Y = rect.Y;

            m_vSize.X = rect.Width;
            m_vSize.Y = rect.Height;

            m_pImage = texture;
            m_cColour = Microsoft.Xna.Framework.Graphics.Color.Black;
        }

        public void DrawElement(GameTime gameTime, SpriteBatch Batch)
        {
            Batch.Draw(m_pImage, new Rectangle((int)m_vPos.X, (int)m_vPos.Y, (int)m_vSize.X, (int)m_vSize.Y), m_cColour);
        }
    }
}
